import Vue from 'vue'
import VueRouter from 'vue-router'
import Main from '@/views/Main.vue'
import Login from '@/views/Login.vue'
import DingDing from '@/views/DingDing.vue'
import {
  Empty
} from 'element-ui'
// import totalRouter from './routerConfig';
Vue.use(VueRouter)



export const roleRoute = {
  //业务人员路由
  businessUserRoute: {
    home: {
      path: '/index',
      component: Main,
      redirect: '/index',
      children: [{
        path: '/index',
        component: () => import('@/views/Main/BusinessUser/index/index'),
        name: 'Index',
        meta: {
          title: '首页',
          icon: 'home',
          noCache: false,
          affix: true
        }
      }]
    },
    dataMonitor: {
      component: Main,
      hidden: false,
      meta: {
        title: "数据监测",
        icon: "server",
        noCache: false,
        link: "http://web.zhgylgl.com/screen/#/?type=0"
      },
      name: "Http://web.zhgylgl.com/screen/#/?type=0",
      path: "http://web.zhgylgl.com/screen/#/?type=0",
    },
    polyQuery: {
      path: '/polyQuery',
      component: Main,
      redirect: '/polyQuery',
      children: [{
        path: '/polyQuery',
        component: () => import('@/views/Main/BusinessUser/polyQuery/polyQuery'),
        name: 'polyQuery',
        meta: {
          title: '聚合查询',
          icon: 'tree',
          noCache: false,
          affix: true
        }
      }]
    },
    shipperManager: {
      name: "shipperManager",
      path: "/shipperManager",
      hidden: false,
      component: Main,
      alwaysShow: true, //单个标签也显示item
      meta: {
        title: "货主管理",
        icon: "manage1",
        noCache: false,
        link: null
      },
      children: [{
        path: 'index',
        component: () => import('@/views/Main/BusinessUser/shipperManager/index'),
        name: 'shipperManagerIndex',
        meta: {
          title: '货主审核',
          icon: 'list',
          affix: false,
          noCache: false
        }
      }]
    
    },

    driverCarManager: {
      name: "driverCarManager",
      path: "/driverCarManager",
      hidden: false,
      component: Main,
      alwaysShow: true, //单个标签也显示item
      meta: {
        "title": "司机车辆管理",
        "icon": "build",
        "link": null
      },
      children: [{
          path: 'driverAuditing',
          component: () => import('@/views/Main/BusinessUser/driverCarManager/driverAuditing'),
          name: 'driverAuditing',
          meta: {
            title: '司机审核',
            icon: 'list',
            affix: false
          }
        },
        {
          path: 'carAuditing',
          component: () => import('@/views/Main/BusinessUser/driverCarManager/carAuditing'),
          name: 'carAuditing',
          meta: {
            title: '车辆审核',
            icon: 'dashboard',
            affix: false
          }
        },
        // {
        //   path: 'driverList',
        //   component: () => import('@/views/Main/BusinessUser/driverCarManager/driverList'),
        //   name: 'driverList',
        //   meta: {
        //     title: '司机列表',
        //     icon: 'peoples',
        //     affix: false
        //   }
        // },
      ]
    },

    waybillManagement: {
      name: "waybillManagement",
      path: "/waybillManagement",
      hidden: false,
      component: Main,
      alwaysShow: true, //单个标签也显示item
      meta: {
        "title": "运单管理",
        "icon": "manage",
        "link": null,
        "noCache": false,
      },
      children: [{
          path: 'allList',
          component: () => import('@/views/Main/BusinessUser/waybillManagement/allList'),
          name: 'allList',
          meta: {
            title: '总运单列表',
            icon: 'allWaybill',
            affix: false
          }
        },
        {
          path: 'inList',
          component: () => import('@/views/Main/BusinessUser/waybillManagement/inList'),
          name: 'inList',
          meta: {
            title: '进行中运单',
            icon: 'documentation',
            affix: false
          }
        },
        {
          path: 'suspendList',
          component: () => import('@/views/Main/BusinessUser/waybillManagement/suspendList'),
          name: 'suspendList',
          meta: {
            title: '已暂停运单',
            icon: '24gf-pauseSquare',
            affix: false
          }
        },
        {
          path: 'trackList',
          component: () => import('@/views/Main/BusinessUser/waybillManagement/trackList'),
          name: 'trackList',
          meta: {
            title: '分运单追踪',
            icon: 'clipboard',
            affix: false
          }
        },
        // {
        //   path: 'unusualList',
        //   component: () => import('@/views/Main/BusinessUser/waybillManagement/unusualList.vue'),
        //   name: 'unusualList',
        //   meta: {
        //     title: '异常运单',
        //     icon: 'clipboard',
        //     affix: false
        //   }
        // },
        {
          path: 'releasewaybill',
          component: () => import('@/views/Main/BusinessUser/waybillManagement/releaseWaybill/releaseWaybill.vue'),
          name: 'releasewaybill',
          meta: {
            title: '发布运单',
            icon: 'dashboard',
            affix: false
          }
        },
        {
          path: 'oftenAddress',
          component: () => import('@/views/Main/BusinessUser/waybillManagement/oftenAddress/oftenAddress.vue'),
          name: 'oftenAddress',
          meta: {
            title: '地址管理',
            icon: 'dashboard',
            affix: false
          }
        }
      ]
    },
    moneyManagment: {
      name: "moneyManagment",
      path: "/moneyManagment",
      hidden: false,
      component: Main,
      alwaysShow: true, //单个标签也显示item
      meta: {
        "title": "财务管理",
        "icon": "tixian(2)",
        "link": null,
        "noCache": false,
      },
      children: [{
          path: 'auditing',
          component: () => import('@/views/Main/BusinessUser/moneyManagment/auditing'),
          name: 'auditing',
          meta: {
            title: '财务审核',
            icon: 'pay',
            affix: false
          }
        },
        // {
        //   path: 'payManage',
        //   component: () => import('@/views/Main/BusinessUser/moneyManagment/payManage/payManage.vue'),
        //   name: 'payManage',
        //   meta: {
        //     title: '支付管理',
        //     icon: 'money',
        //     affix: false
        //   }
        // },
        // {
        //   path: 'withdrawalRecord',
        //   component: () => import('@/views/Main/BusinessUser/moneyManagment/withdrawalRecord/index.vue'),
        //   name: 'withdrawalRecord',
        //   meta: {
        //     title: '提现记录',
        //     icon: 'tixian(2)',
        //     affix: false
        //   }
        // },
        // {
        //   name: "approveList",
        //   path: "approveList",
        //   component: () => import('@/views/Main/BusinessUser/moneyManagment/approveList/approveList'),
        //   meta: {
        //     title: '审批列表',
        //     icon: 'prePay',
        //     affix: false
        //   }
        // },
        // {
        //   path: 'collect',
        //   component: () => import('@/views/Main/BusinessUser/moneyManagment/collect'),
        //   name: 'collect',
        //   meta: {
        //     title: '汇总代开',
        //     icon: 'operation_all_list',
        //     affix: false
        //   }
        // },
        {
          path: 'shipperStream',
          component: () => import('@/views/Main/BusinessUser/moneyManagment/shipperStream/shipperStream'),
          name: 'shipperStream',
          meta: {
            title: '货主流水',
            icon: 'goods_user',
            affix: false
          }
        },
        // {
        //   path: 'driverStream',
        //   component: () => import('@/views/Main/BusinessUser/moneyManagment/driverStream'),
        //   name: 'driverStream',
        //   meta: {
        //     title: '司机收款信息',
        //     icon: 'driver_management',
        //     affix: false
        //   }
        // },
        // {
        //   path: 'vaildate',
        //   component: () => import('@/views/Main/BusinessUser/moneyManagment/payValidate/payValidate'),
        //   name: 'vaildate',
        //   meta: {
        //     title: '支付结果验证',
        //     icon: 'validate',
        //     affix: false
        //   }
        // },
        // {
        //   name: "invoiceManage",
        //   path: "invoiceManage",
        //   component: () => import('@/views/Main/BusinessUser/moneyManagment/invoiceManage/invoiceManage'),
        //   meta: {
        //     title: '发票管理',
        //     icon: 'waybill',
        //     affix: false
        //   }
        // },
        // {
        //   name: "invoiceDetail",
        //   path: "invoiceDetail",
        //   component: () => import('@/views/Main/BusinessUser/moneyManagment/invoiceDetail/invoiceDetail'),
        //   meta: {
        //     title: '发票明细',
        //     icon: 'waybill',
        //     affix: false
        //   }
        // },
        // {
        //   name: "bankCardManagment",
        //   path: "bankCardManagment",
        //   component: () => import('@/views/Main/BusinessUser/moneyManagment/bankCardManagment/bankCardManagment'),
        //   meta: {
        //     title: '常用银行卡管理',
        //     icon: 'bankCard',
        //     affix: false
        //   }
        // },
        // {
        //   name: "prePay",
        //   path: "prePay",
        //   component: () => import('@/views/Main/BusinessUser/moneyManagment/prePay/prePay'),
        //   meta: {
        //     title: '预支付列表',
        //     icon: 'prePay',
        //     affix: false
        //   }
        // },

      ]
    },
    // GoodsManagment: {
    //   name: "GoodsManagment",
    //   path: "/goodsManagment",
    //   hidden: false,
    //   component: Main,
    //   alwaysShow: true, //单个标签也显示item
    //   meta: {
    //     title: "货源管理",
    //     icon: "cascader",
    //     noCache: false,
    //     link: null
    //   },
    //   children: [
    //     // {
    //     //   path: 'release',
    //     //   component: () => import('@/views/Main/BusinessUser/GoodsManagment/release'),
    //     //   name: 'release',
    //     //   meta: { title: '发布货源', icon: 'dashboard', affix: false }
    //     // },
    //     {
    //       path: 'list',
    //       component: () => import('@/views/Main/BusinessUser/GoodsManagment/list'),
    //       name: 'list',
    //       meta: {
    //         title: '货源列表',
    //         icon: 'documentation',
    //         affix: false
    //       }
    //     },
    //     // {
    //     //   name: "robWaybill",
    //     //   path: "robWaybill",
    //     //   component: () => import('@/views/Main/BusinessUser/GoodsManagment/robWaybill'),
    //     //   meta: { title: '抢单列表', icon: 'dashboard', affix: false }
    //     // }
    //   ]
    // }
  },
  //子公司路由
  childCompanyRoute: {
    home: {
      path: '/index',
      component: Main,
      redirect: '/index',
      children: [{
        path: '/index',
        component: () => import('@/views/Main/ChildCompany/index/index'),
        name: 'Index',
        meta: {
          title: '首页',
          icon: 'home',
          noCache: false,
          affix: true
        }
      }]
    },
    dataMonitor: {
      component: Main,
      hidden: false,
      meta: {
        title: "数据监测",
        icon: "server",
        noCache: false,
        link: "http://web.zhgylgl.com/screen/#/?type=0"
      },
      name: "Http://web.zhgylgl.com/screen/#/?type=0",
      path: "http://web.zhgylgl.com/screen/#/?type=0",
    },
    polyQuery: {
      path: '/polyQuery',
      component: Main,
      redirect: '/polyQuery',
      children: [{
        path: '/polyQuery',
        component: () => import('@/views/Main/ChildCompany/polyQuery/polyQuery'),
        name: 'polyQuery',
        meta: {
          title: '聚合查询',
          icon: 'tree',
          noCache: false,
          affix: true
        }
      }]
    },
    shipperManager: {
      name: "shipperManager",
      path: "/shipperManager",
      hidden: false,
      component: Main,
      alwaysShow: true, //单个标签也显示item
      meta: {
        title: "货主管理",
        icon: "manage1",
        noCache: false,
        link: null
      },
      children: [{
        path: 'index',
        component: () => import('@/views/Main/ChildCompany/shipperManager/index'),
        name: 'shipperManagerIndex',
        meta: {
          title: '货主审核',
          icon: 'list',
          affix: false,
          noCache: false
        }
      }]
    },
    driverCarManager: {
      name: "driverCarManager",
      path: "/driverCarManager",
      hidden: false,
      component: Main,
      alwaysShow: true, //单个标签也显示item
      meta: {
        "title": "司机车辆管理",
        "icon": "build",
        "link": null
      },
      children: [{
          path: 'driverAuditing',
          component: () => import('@/views/Main/ChildCompany/driverCarManager/driverAuditing'),
          name: 'driverAuditing',
          meta: {
            title: '司机审核',
            icon: 'list',
            affix: false
          }
        },
        {
          path: 'carAuditing',
          component: () => import('@/views/Main/ChildCompany/driverCarManager/carAuditing'),
          name: 'carAuditing',
          meta: {
            title: '车辆审核',
            icon: 'dashboard',
            affix: false
          }
        },
        // {
        //   path: 'driverList',
        //   component: () => import('@/views/Main/ChildCompany/driverCarManager/driverList'),
        //   name: 'driverList',
        //   meta: {
        //     title: '司机列表',
        //     icon: 'peoples',
        //     affix: false
        //   }
        // },
      ]
    },
    waybillManagement: {
      name: "waybillManagement",
      path: "/waybillManagement",
      hidden: false,
      component: Main,
      alwaysShow: true, //单个标签也显示item
      meta: {
        "title": "运单管理",
        "icon": "manage",
        "link": null,
        "noCache": false,
      },
      children: [{
          path: 'allList',
          component: () => import('@/views/Main/ChildCompany/waybillManagement/allList'),
          name: 'allList',
          meta: {
            title: '总运单列表',
            icon: 'allWaybill',
            affix: false
          }
        },
        {
          path: 'inList',
          component: () => import('@/views/Main/ChildCompany/waybillManagement/inList'),
          name: 'inList',
          meta: {
            title: '进行中运单',
            icon: 'documentation',
            affix: false
          }
        },
        {
          path: 'suspendList',
          component: () => import('@/views/Main/ChildCompany/waybillManagement/suspendList'),
          name: 'suspendList',
          meta: {
            title: '已暂停运单',
            icon: '24gf-pauseSquare',
            affix: false
          }
        },
        {
          path: 'trackList',
          component: () => import('@/views/Main/ChildCompany/waybillManagement/trackList'),
          name: 'trackList',
          meta: {
            title: '分运单追踪',
            icon: 'clipboard',
            affix: false
          }
        },
        // {
        //   path: 'unusualList',
        //   component: () => import('@/views/Main/ChildCompany/waybillManagement/unusualList.vue'),
        //   name: 'unusualList',
        //   meta: {
        //     title: '异常运单',
        //     icon: 'clipboard',
        //     affix: false
        //   }
        // },
        {
          path: 'releasewaybill',
          component: () => import('@/views/Main/ChildCompany/waybillManagement/releaseWaybill/releaseWaybill.vue'),
          name: 'releasewaybill',
          meta: {
            title: '发布运单',
            icon: 'dashboard',
            affix: false
          }
        },
        {
          path: 'oftenAddress',
          component: () => import('@/views/Main/ChildCompany/waybillManagement/oftenAddress/oftenAddress.vue'),
          name: 'oftenAddress',
          meta: {
            title: '地址管理',
            icon: 'dashboard',
            affix: false
          }
        }
      ]
    },
    moneyManagment: {
      name: "moneyManagment",
      path: "/moneyManagment",
      hidden: false,
      component: Main,
      alwaysShow: true, //单个标签也显示item
      meta: {
        "title": "财务管理",
        "icon": "tixian(2)",
        "link": null,
        "noCache": false,
      },
      children: [
        {
          path: 'auditing',
          component: () => import('@/views/Main/ChildCompany/moneyManagment/auditing'),
          name: 'auditing',
          meta: {
            title: '财务审核',
            icon: 'pay',
            affix: false
          }
        },
        // {
        //   path: 'payManage',
        //   component: () => import('@/views/Main/ChildCompany/moneyManagment/payManage/payManage.vue'),
        //   name: 'payManage',
        //   meta: {
        //     title: '支付管理',
        //     icon: 'money',
        //     affix: false
        //   }
        // },
        // {
        //   path: 'withdrawalRecord',
        //   component: () => import('@/views/Main/ChildCompany/moneyManagment/withdrawalRecord/index.vue'),
        //   name: 'withdrawalRecord',
        //   meta: {
        //     title: '提现记录',
        //     icon: 'tixian(2)',
        //     affix: false
        //   }
        // },
        // {
        //   name: "approveList",
        //   path: "approveList",
        //   component: () => import('@/views/Main/ChildCompany/moneyManagment/approveList/approveList'),
        //   meta: {
        //     title: '审批列表',
        //     icon: 'prePay',
        //     affix: false
        //   }
        // },
        // {
        //   path: 'collect',
        //   component: () => import('@/views/Main/ChildCompany/moneyManagment/collect'),
        //   name: 'collect',
        //   meta: {
        //     title: '汇总代开',
        //     icon: 'operation_all_list',
        //     affix: false
        //   }
        // },
        {
          path: 'shipperStream',
          component: () => import('@/views/Main/ChildCompany/moneyManagment/shipperStream/shipperStream'),
          name: 'shipperStream',
          meta: {
            title: '货主流水',
            icon: 'goods_user',
            affix: false
          }
        },
        // {
        //   path: 'driverStream',
        //   component: () => import('@/views/Main/ChildCompany/moneyManagment/driverStream'),
        //   name: 'driverStream',
        //   meta: {
        //     title: '司机收款信息',
        //     icon: 'driver_management',
        //     affix: false
        //   }
        // },
        // {
        //   path: 'vaildate',
        //   component: () => import('@/views/Main/ChildCompany/moneyManagment/payValidate/payValidate'),
        //   name: 'vaildate',
        //   meta: {
        //     title: '支付结果验证',
        //     icon: 'validate',
        //     affix: false
        //   }
        // },
        // {
        //   name: "invoiceManage",
        //   path: "invoiceManage",
        //   component: () => import('@/views/Main/ChildCompany/moneyManagment/invoiceManage/invoiceManage'),
        //   meta: {
        //     title: '发票管理',
        //     icon: 'waybill',
        //     affix: false
        //   }
        // },
        // {
        //   name: "invoiceDetail",
        //   path: "invoiceDetail",
        //   component: () => import('@/views/Main/ChildCompany/moneyManagment/invoiceDetail/invoiceDetail'),
        //   meta: {
        //     title: '发票明细',
        //     icon: 'waybill',
        //     affix: false
        //   }
        // },
        // {
        //   name: "bankCardManagment",
        //   path: "bankCardManagment",
        //   component: () => import('@/views/Main/ChildCompany/moneyManagment/bankCardManagment/bankCardManagment'),
        //   meta: {
        //     title: '常用银行卡管理',
        //     icon: 'bankCard',
        //     affix: false
        //   }
        // },
        // {
        //   name: "prePay",
        //   path: "prePay",
        //   component: () => import('@/views/Main/ChildCompany/moneyManagment/prePay/prePay'),
        //   meta: {
        //     title: '预支付列表',
        //     icon: 'prePay',
        //     affix: false
        //   }
        // },

      ]
    },
    // GoodsManagment: {
    //   name: "GoodsManagment",
    //   path: "/goodsManagment",
    //   hidden: false,
    //   component: Main,
    //   alwaysShow: true, //单个标签也显示item
    //   meta: {
    //     title: "货源管理",
    //     icon: "cascader",
    //     noCache: false,
    //     link: null
    //   },
    //   children: [
    //     // {
    //     //   path: 'release',
    //     //   component: () => import('@/views/Main/ChildCompany/GoodsManagment/release'),
    //     //   name: 'release',
    //     //   meta: { title: '发布货源', icon: 'dashboard', affix: false }
    //     // },
    //     {
    //       path: 'list',
    //       component: () => import('@/views/Main/ChildCompany/GoodsManagment/list'),
    //       name: 'list',
    //       meta: {
    //         title: '货源列表',
    //         icon: 'documentation',
    //         affix: false
    //       }
    //     },
    //     // {
    //     //   name: "robWaybill",
    //     //   path: "robWaybill",
    //     //   component: () => import('@/views/Main/ChildCompany/GoodsManagment/robWaybill'),
    //     //   meta: { title: '抢单列表', icon: 'dashboard', affix: false }
    //     // }
    //   ]
    // }
  }
}




//首页路由
const home = {
  path: '/index',
  component: Main,
  redirect: '/index',
  children: [{
    path: '/index',
    component: () => import('@/views/MainPage/index/index'),
    name: 'Index',
    meta: {
      title: '首页',
      icon: 'home',
      noCache: false,
      affix: true
    }
  }]
};

const polyQuery = {
  path: '/polyQuery',
  component: Main,
  redirect: '/polyQuery',
  children: [{
    path: '/polyQuery',
    component: () => import('@/views/MainPage/polyQuery/polyQuery'),
    name: 'polyQuery',
    meta: {
      title: '聚合查询',
      icon: 'tree',
      noCache: false,
      affix: true
    }
  }]
}

//数据监测路由
const dataMonitor = {
  component: Main,
  hidden: false,
  meta: {
    title: "数据监测",
    icon: "server",
    noCache: false,
    link: "http://web.zhgylgl.com/screen/#/?type=0"
  },
  name: "Http://web.zhgylgl.com/screen/#/?type=0",
  path: "http://web.zhgylgl.com/screen/#/?type=0",
}

//货主管理路由
const shipperManager = {
  name: "shipperManager",
  path: "/shipperManager",
  hidden: false,
  component: Main,
  alwaysShow: true, //单个标签也显示item
  meta: {
    title: "货主管理",
    icon: "manage1",
    noCache: false,
    link: null
  },
  children: [{
    path: 'index',
    component: () => import('@/views/MainPage/shipperManager/index'),
    name: 'shipperManagerIndex',
    meta: {
      title: '货主审核',
      icon: 'list',
      affix: false,
      noCache: false
    }
  }]
}


//司机车辆管理路由
const driverCarManager = {
  name: "driverCarManager",
  path: "/driverCarManager",
  hidden: false,
  component: Main,
  alwaysShow: true, //单个标签也显示item
  meta: {
    "title": "司机车辆管理",
    "icon": "build",
    "link": null
  },
  children: [{
      path: 'driverAuditing',
      component: () => import('@/views/MainPage/driverCarManager/driverAuditing'),
      name: 'driverAuditing',
      meta: {
        title: '司机审核',
        icon: 'list',
        affix: false
      }
    },
    {
      path: 'carAuditing',
      component: () => import('@/views/MainPage/driverCarManager/carAuditing'),
      name: 'carAuditing',
      meta: {
        title: '车辆审核',
        icon: 'dashboard',
        affix: false
      }
    },
    {
      path: 'driverList',
      component: () => import('@/views/MainPage/driverCarManager/driverList'),
      name: 'driverList',
      meta: {
        title: '司机列表',
        icon: 'peoples',
        affix: false
      }
    },
  ]
}


//运单管理路由
const waybillManagement = {
  name: "waybillManagement",
  path: "/waybillManagement",
  hidden: false,
  component: Main,
  alwaysShow: true, //单个标签也显示item
  meta: {
    "title": "运单管理",
    "icon": "manage",
    "link": null,
    "noCache": false,
  },
  children: [{
      path: 'allList',
      component: () => import('@/views/MainPage/waybillManagement/allList'),
      name: 'allList',
      meta: {
        title: '总运单列表',
        icon: 'allWaybill',
        affix: false
      }
    },
    {
      path: 'inList',
      component: () => import('@/views/MainPage/waybillManagement/inList'),
      name: 'inList',
      meta: {
        title: '进行中运单',
        icon: 'documentation',
        affix: false
      }
    },
    {
      path: 'suspendList',
      component: () => import('@/views/MainPage/waybillManagement/suspendList'),
      name: 'suspendList',
      meta: {
        title: '已暂停运单',
        icon: '24gf-pauseSquare',
        affix: false
      }
    },
    {
      path: 'trackList',
      component: () => import('@/views/MainPage/waybillManagement/trackList'),
      name: 'trackList',
      meta: {
        title: '分运单追踪',
        icon: 'clipboard',
        affix: false
      }
    },
    {
      path: 'unusualList',
      component: () => import('@/views/MainPage/waybillManagement/unusualList.vue'),
      name: 'unusualList',
      meta: {
        title: '异常运单',
        icon: 'clipboard',
        affix: false
      }
    },
    {
      path: 'releasewaybill',
      component: () => import('@/views/MainPage/waybillManagement/releaseWaybill/releaseWaybill.vue'),
      name: 'releasewaybill',
      meta: {
        title: '发布运单',
        icon: 'dashboard',
        affix: false
      }
    },
    {
      path: 'oftenAddress',
      component: () => import('@/views/MainPage/waybillManagement/oftenAddress/oftenAddress.vue'),
      name: 'oftenAddress',
      meta: {
        title: '地址管理',
        icon: 'dashboard',
        affix: false
      }
    }
  ]
}


//财务管理路由
const moneyManagment = {
  name: "moneyManagment",
  path: "/moneyManagment",
  hidden: false,
  component: Main,
  alwaysShow: true, //单个标签也显示item
  meta: {
    "title": "财务管理",
    "icon": "tixian(2)",
    "link": null,
    "noCache": false,
  },
  children: [{
      path: 'auditing',
      component: () => import('@/views/MainPage/moneyManagment/auditing'),
      name: 'auditing',
      meta: {
        title: '财务审核',
        icon: 'pay',
        affix: false
      }
    },
    {
      path: 'payManage',
      component: () => import('@/views/MainPage/moneyManagment/payManage/payManage.vue'),
      name: 'payManage',
      meta: {
        title: '支付管理',
        icon: 'money',
        affix: false
      }
    },
    {
      path: 'withdrawalRecord',
      component: () => import('@/views/MainPage/moneyManagment/withdrawalRecord/index.vue'),
      name: 'withdrawalRecord',
      meta: {
        title: '提现记录',
        icon: 'tixian(2)',
        affix: false
      }
    },
    {
      name: "approveList",
      path: "approveList",
      component: () => import('@/views/MainPage/moneyManagment/approveList/approveList'),
      meta: {
        title: '审批列表',
        icon: 'prePay',
        affix: false
      }
    },
    {
      path: 'collect',
      component: () => import('@/views/MainPage/moneyManagment/collect'),
      name: 'collect',
      meta: {
        title: '汇总代开',
        icon: 'operation_all_list',
        affix: false
      }
    },
    {
      path: 'shipperStream',
      component: () => import('@/views/MainPage/moneyManagment/shipperStream/shipperStream'),
      name: 'shipperStream',
      meta: {
        title: '货主流水',
        icon: 'goods_user',
        affix: false
      }
    },
    {
      path: 'driverStream',
      component: () => import('@/views/MainPage/moneyManagment/driverStream'),
      name: 'driverStream',
      meta: {
        title: '司机收款信息',
        icon: 'driver_management',
        affix: false
      }
    },
    {
      path: 'vaildate',
      component: () => import('@/views/MainPage/moneyManagment/payValidate/payValidate'),
      name: 'vaildate',
      meta: {
        title: '支付结果验证',
        icon: 'validate',
        affix: false
      }
    },
    {
      name: "invoiceManage",
      path: "invoiceManage",
      component: () => import('@/views/MainPage/moneyManagment/invoiceManage/invoiceManage'),
      meta: {
        title: '发票管理',
        icon: 'waybill',
        affix: false
      }
    },
    {
      name: "invoiceDetail",
      path: "invoiceDetail",
      component: () => import('@/views/MainPage/moneyManagment/invoiceDetail/invoiceDetail'),
      meta: {
        title: '发票明细',
        icon: 'waybill',
        affix: false
      }
    },
    {
      name: "bankCardManagment",
      path: "bankCardManagment",
      component: () => import('@/views/MainPage/moneyManagment/bankCardManagment/bankCardManagment'),
      meta: {
        title: '常用银行卡管理',
        icon: 'bankCard',
        affix: false
      }
    },
    {
      name: "prePay",
      path: "prePay",
      component: () => import('@/views/MainPage/moneyManagment/prePay/prePay'),
      meta: {
        title: '预支付列表',
        icon: 'prePay',
        affix: false
      }
    },

  ]
}


//货源管理路由
const GoodsManagment = {
  name: "GoodsManagment",
  path: "/goodsManagment",
  hidden: false,
  component: Main,
  alwaysShow: true, //单个标签也显示item
  meta: {
    title: "货源管理",
    icon: "cascader",
    noCache: false,
    link: null
  },
  children: [
    // {
    //   path: 'release',
    //   component: () => import('@/views/MainPage/GoodsManagment/release'),
    //   name: 'release',
    //   meta: { title: '发布货源', icon: 'dashboard', affix: false }
    // },
    {
      path: 'list',
      component: () => import('@/views/MainPage/GoodsManagment/list'),
      name: 'list',
      meta: {
        title: '货源列表',
        icon: 'documentation',
        affix: false
      }
    },
    // {
    //   name: "robWaybill",
    //   path: "robWaybill",
    //   component: () => import('@/views/MainPage/GoodsManagment/robWaybill'),
    //   meta: { title: '抢单列表', icon: 'dashboard', affix: false }
    // }
  ]
}


//官网配置路由
const PageConfig = {
  name: "PageConfig",
  path: "/pageConfig",
  hidden: false,
  component: Main,
  alwaysShow: true, //单个标签也显示item
  meta: {
    title: "官网配置",
    icon: "monitor",
    noCache: false,
    link: null
  },
  children: [
    // {
    //   path: 'release',
    //   component: () => import('@/views/MainPage/GoodsManagment/release'),
    //   name: 'release',
    //   meta: { title: '发布货源', icon: 'dashboard', affix: true }
    // },
    {
      path: 'list',
      component: () => import('@/views/MainPage/pageConfig/list'),
      name: 'list',
      meta: {
        title: '配置列表',
        icon: 'list',
        affix: false
      }
    },
    {
      path: 'edit',
      component: () => import('@/views/MainPage/pageConfig/edit'),
      name: 'edit',
      meta: {
        title: '配置数据',
        icon: 'documentation',
        affix: false
      }
    },
    // {
    //   name: "robWaybill",
    //   path: "robWaybill",
    //   component: () => import('@/views/MainPage/GoodsManagment/robWaybill'),
    //   meta: { title: '抢单列表', icon: 'dashboard', affix: true }
    // }
  ]
}


//会员管理路由
const VIP = {
  name: "VIP",
  path: "/vip",
  hidden: false,
  component: Main,
  redirect: "noRedirect",
  alwaysShow: true, //单个标签也显示item
  meta: {
    title: "会员管理",
    icon: "VIP",
    noCache: false,
    link: null
  },
  children: [{
    path: 'auditing',
    component: () => import('@/views/MainPage/VIPManagement/VIPAuditing'),
    name: 'list',
    meta: {
      title: '会员审核',
      icon: 'list',
      affix: false
    }
  }]
}


//提现管理路由
const withdraw = {
  name: "withdraw",
  path: "/withdraw",
  hidden: false,
  component: Main,
  alwaysShow: true, //单个标签也显示item
  meta: {
    "title": "提现管理",
    "icon": "system",
    "link": null
  },
  children: [{
    path: 'allList',
    component: () => import('@/views/MainPage/withdraw/allList'),
    name: 'allList',
    meta: {
      title: '提现管理',
      icon: 'dashboard',
      affix: false
    }
  }]
}

//加油站管理路由
const gasStation = {
  name: "gasStation",
  path: "/gasStation",
  hidden: false,
  component: Main,
  alwaysShow: true, //单个标签也显示item
  meta: {
    "title": "加油站管理",
    "icon": "druid",
    "link": null
  },
  children: [{
      path: 'gasStationReview',
      component: () => import('@/views/MainPage/gasStation/gasStationReview/gasStationReview'),
      name: 'allList',
      meta: {
        title: '加油站审核',
        icon: 'list',
        affix: false
      }
    },
    {
      path: 'oilBillList',
      component: () => import('@/views/MainPage/gasStation/oilBillList/oilBillList'),
      name: 'oilBillList',
      meta: {
        title: '油气订单列表',
        icon: 'list',
        affix: false
      }
    },
    {
      path: 'oilPriceManage',
      component: () => import('@/views/MainPage/gasStation/oilPriceManage/oilPriceManage'),
      name: 'oilPriceManage',
      meta: {
        title: '油价管理',
        icon: 'documentation',
        affix: false
      }
    },
    {
      path: 'cashOut',
      component: () => import('@/views/MainPage/gasStation/cashOut/cashOut'),
      name: 'cashOut',
      meta: {
        title: '提现管理',
        icon: 'documentation',
        affix: false
      }
    }
  ]
}

//设置路由
const setting = {
  name: "set",
  path: "/set",
  hidden: false,
  component: Main,
  redirect: "noRedirect",
  alwaysShow: true, //单个标签也显示item
  meta: {
    title: "设置",
    icon: "system",
    noCache: false,
    link: null
  },
  children: [{
      path: 'index',
      component: () => import('@/views/MainPage/Set/index/index'),
      name: 'setindex',
      meta: {
        title: '总配置',
        icon: 'set',
        affix: false
      }
    },
    {
      path: 'info',
      component: () => import('@/views/MainPage/Set/info/index'),
      name: 'info',
      meta: {
        title: '平台信息',
        icon: 'version',
        affix: false
      }
    },
    {
      path: 'codeLog',
      component: () => import('@/views/MainPage/Set/CodeLog/codeLog'),
      name: 'codeLog',
      meta: {
        title: '验证码查询',
        icon: 'list',
        affix: false
      }
    },
    {
      path: 'userVersion',
      component: () => import('@/views/MainPage/Set/userVersion/index'),
      name: 'user_Version',
      meta: {
        title: '用户日志',
        icon: 'list',
        affix: false
      }
    },
    {
      path: 'log',
      component: () => import('@/views/MainPage/Set/Log/index'),
      name: 'log',
      meta: {
        title: '平台日志',
        icon: 'list',
        affix: false
      }
    },
    {
      path: 'deviceRecord',
      component: () => import('@/views/MainPage/Set/deviceRecord/index'),
      name: 'deviceRecord',
      meta: {
        title: '设备记录',
        icon: 'version',
        affix: false
      }
    },
    {
      path: 'statistics',
      component: () => import('@/views/MainPage/Set/statistics/statistics'),
      name: 'statistics',
      meta: {
        title: '资源统计',
        icon: 'list',
        affix: false
      }
    },
    {
      path: 'goodsManage',
      component: () => import('@/views/MainPage/Set/goodsManage/goodsManage'),
      name: 'goodsManage',
      meta: {
        title: '货物管理',
        icon: 'list',
        affix: false
      }
    },
    {
      path: 'transportManage',
      component: () => import('@/views/MainPage/Set/transportManage/transportManage'),
      name: 'transportManage',
      meta: {
        title: '运输公司管理',
        icon: 'list',
        affix: false
      }
    },
    {
      path: 'feedback',
      component: () => import('@/views/MainPage/Set/FeedBack/feedback'),
      name: 'feedback',
      meta: {
        title: '反馈记录',
        icon: 'list',
        affix: false
      }
    },
    {
      path: 'evaluate',
      component: () => import('@/views/MainPage/Set/Evaluate/evaluate'),
      name: 'evaluate',
      meta: {
        title: '评价记录',
        icon: 'list',
        affix: false
      }
    },
    {
      path: 'userManage',
      component: () => import('@/views/MainPage/Set/userManage/userManage'),
      name: 'userManage',
      meta: {
        title: '用户设置',
        icon: 'peoples',
        affix: false
      }
    },
  ]
}


//业务管理
const business = {
  name: "business",
  path: "/business",
  hidden: false,
  component: Main,
  redirect: "noRedirect",
  alwaysShow: true, //单个标签也显示item
  meta: {
    title: "业务管理",
    icon: "manage1",
    noCache: false,
    link: null
  },
  children: [{
      path: 'businessperson',
      component: () => import('@/views/MainPage/business/businessperson/businessperson'),
      name: 'businessperson',
      meta: {
        title: '业务人员列表',
        icon: 'peoples',
        affix: false
      }
    },
    {
      path: 'childcompany',
      component: () => import('@/views/MainPage/business/childcompany/childcompany'),
      name: 'childcompany',
      meta: {
        title: '子公司列表',
        icon: 'list',
        affix: false
      }
    },
  ]
}

//权限路由 需要根据当前的用户身份来动态生成
export const roleRouter = {
  // polyQuery,
  shipperManager,
  driverCarManager,
  waybillManagement,
  moneyManagment,
  GoodsManagment,
  PageConfig,
  VIP,
  gasStation,
  // withdraw,
  business,
  setting
}
// console.log('roleRouter', roleRouter);

// let newObj = Object.values(roleRouter).reduce((p,c,i)=>{
//   let name = c.name
//   p[name] = {
//     name:c.name,
//     title:c.meta.title,
//     status:1,
//     children: c.children.map(item=>{
//       let name = item.name
//       return {
//         name,
//         title:item.meta.title,
//         status:1,
//       }
//     })
//   };
//   return p;
// },{})
// console.log("newObj",newObj)

export const routes = [{
    path: '*',
    redirect: '/'
  },
  {
    path: '/redirect',
    component: Main,
    hidden: true,
    children: [{
      path: '/redirect/:path(.*)',
      component: () => import('@/views/redirect')
    }]
  },
  {
    path: '/',
    name: 'login',
    component: Login,
  },
  {
    path: '/dingding',
    component: DingDing,
  },
  // totalRouter,
  // { ...home },
  // { ...polyQuery },
  // {
  //   ...dataMonitor
  // },
  // ...Object.values(roleRouter)
  // ...shipperManager,
  // ...driverCarManager,
  // ...waybillManagement,
  // ...moneyManagment,
  // ...GoodsManagment,
  // ...PageConfig,
  // ...VIP,
  // ...setting,
  // ...withdraw
]

// 防止连续点击多次路由报错
let routerPush = VueRouter.prototype.push;
let routerReplace = VueRouter.prototype.replace;
// push
VueRouter.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(err => err)
}
// replace
VueRouter.prototype.replace = function push(location) {
  return routerReplace.call(this, location).catch(err => err)
}

const router = new VueRouter({
  mode: 'hash',
  scrollBehavior: () => ({
    y: 0
  }),
  routes
});

export default router